import { getApplyingInfo } from '@/api/applying'
import axios from 'axios'
export default {
    namespaced: true,
    state: {
        applyingInfo: []
    },
    getters: {
        setApplyInfo(state) {
            return state.applyingInfo;
        }
    },
    mutations: {
        setApplyingMutation(state, payload) {
            // 将状态为0（申请中的筛选出来）
            let result = payload.filter((item) => {
                return item.isFlag == 0
            })
            state.applyingInfo = result;
        }
    },
    actions: {
        getApplyingAction({ commit }, applyingInfo) {
            return new Promise((resolve, reject) => {
                getApplyingInfo().then((response) => {
                    commit('setApplyingMutation', response.rows)
                    resolve()
                }).catch(error => {
                    reject(error)
                })
            })
        }
    }

}